<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
    <script>
        async function fun1() {
            // return 10 // 走下面then中的resolve方法，返回成功的Promise对象
            // return Promise.resolve('成功') // 走下面then的resolve方法
            // return Promise.reject('失败') // 走下面then的reject方法
            // throw new Error('异常') // 走下面then的reject方法
        }

        let promise =  fun1()

        promise.then(
            function(value) {
                console.log('success = ' + value)
            },
            function(value) {
                console.log('fail = ' + value)
            }
        )
    </script>
</head>
<body>
    
</body>
</html>